//
//  HTemotionBtn.swift
//  表情键盘
//
//  Created by whtapple on 4/6/16.
//  Copyright © 2016 whtapple. All rights reserved.
//

import UIKit

class HTemotionBtn: UIButton {
    
    var model: HTEmotionModel?{
        didSet{
//            Xprint(msg: "\(model)")
             //当emoji不为空时，说明是emoji 表情
            if model!.emoji != nil{
                //设置 emoji表情
                setTitle(model!.emoji, forState: UIControlState.Normal)
                //设置字体和其他表情图片的尺寸一样大，这样emoji表情显示的图片就会和其他的图片一样大
               titleLabel?.font = UIFont.systemFontOfSize(32)
                //防止复用
               setImage(nil, forState: UIControlState.Normal)
            }else{
                //防止 title复用
              setTitle(nil, forState: UIControlState.Normal)
                //设置图片
               setImage(UIImage(named: model!.fullpngPath!), forState: UIControlState.Normal)
            }
        }
    }
}

